package pattern.mvc;


/**
 * mva 模式代码测试案例
 */
public class MVCPatternDemo {

    public static void main(String[] args) {

        // 从数据可以获取学生记录
        Student model  = retrieveStudentFromDatabase();

        // 创建一个视图，把学校详情显示到控制台
        StudentView studentView = new StudentView();
        StudentController studentController = new StudentController(model, studentView);
        studentController.updateView();

        // 跟新模型数据
        studentController.setStudentName("John");
        studentController.updateView();

    }


    private static Student retrieveStudentFromDatabase() {
        Student model  = new Student();
        model.setName("Robert");
        model.setRollNo("10");
        return model;
    }

}
